import redis

# Redis配置 - 与redis_to_json.py保持一致
REDIS_CONFIG = {
    'host': 'localhost',
    'port': 6379,
    'password': '',
    'db': 0
}

# 示例数据 - 与KEYS_TO_READ对应
DEMO_DATA = {
    'K4yps_104AWp': '111.25',
    'K4yps_104AWn': '222.36',
    'K4yps_103AWp': '300.0',
    'K4yps_103AWn': '300.0',
    'K4yps_103BWp': '300.0',
    'K4yps_103BWn': '300.0',
    'K4yps_104BWp': '300.0',
    'K4yps_104BWn': '300.0',
    'K4yps_106AWp': '300.0',
    'K4yps_106AWn': '300.0',
    'K4yps_106BWp': '300.0',
    'K4yps_106BWn': '300.0',
    'K4yps_105AWp': '300.0',
    'K4yps_105AWn': '300.0',
    'K4yps_105BWp': '300.0',
    'K4yps_105BWn': '300.0',



}

def main():
    try:
        # 连接Redis
        r = redis.Redis(**REDIS_CONFIG)
        
        # 插入示例数据
        for key, value in DEMO_DATA.items():
            r.set(key, value)
            print(f'已插入: {key} = {value}')
        
        print('所有示例数据插入完成')
    except Exception as e:
        print(f'执行失败: {str(e)}')

if __name__ == '__main__':
    main()